package com.ficus.road.maintain.util.queue;


import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

public class BlockingQueueBaseDecorator<E> implements BlockingQueue<E> {

    private BlockingQueue<E> blockingQueue;

    protected BlockingQueueBaseDecorator(BlockingQueue<E> blockingQueue) {
        this.blockingQueue = blockingQueue;
    }

    protected BlockingQueue<E> getBlockingQueue() {
        return blockingQueue;
    }

    @Override
    public boolean add(@NotNull E e) {
        return blockingQueue.add(e);
    }

    @Override
    public boolean offer(@NotNull E e) {
        return blockingQueue.offer(e);
    }

    @Override
    public void put(@NotNull E e) throws InterruptedException {
        blockingQueue.put(e);
    }

    @Override
    public boolean offer(E e, long l, @NotNull TimeUnit timeUnit) throws InterruptedException {
        return blockingQueue.offer(e, l, timeUnit);
    }

    @NotNull
    @Override
    public E take() throws InterruptedException {
        return blockingQueue.take();
    }

    @Override
    public E poll() {
        return blockingQueue.poll();
    }

    @Override
    public E element() {
        return blockingQueue.element();
    }

    @Override
    public E peek() {
        return blockingQueue.peek();
    }

    @Override
    public int size() {
        return blockingQueue.size();
    }

    @Override
    public boolean isEmpty() {
        return blockingQueue.isEmpty();
    }

    @NotNull
    @Override
    public Iterator<E> iterator() {
        return blockingQueue.iterator();
    }

    @NotNull
    @Override
    public Object[] toArray() {
        return blockingQueue.toArray();
    }

    @NotNull
    @Override
    public <T> T[] toArray(@NotNull T[] ts) {
        return blockingQueue.<T>toArray(ts);
    }

    @Override
    public boolean containsAll(@NotNull Collection<?> collection) {
        return blockingQueue.containsAll(collection);
    }

    @Override
    public boolean addAll(@NotNull Collection<? extends E> collection) {
        return blockingQueue.addAll(collection);
    }

    @Override
    public boolean removeAll(@NotNull Collection<?> collection) {
        return blockingQueue.removeAll(collection);
    }

    @Override
    public boolean retainAll(@NotNull Collection<?> collection) {
        return blockingQueue.retainAll(collection);
    }

    @Override
    public void clear() {
        blockingQueue.clear();
    }

    @Nullable
    @Override
    public E poll(long l, @NotNull TimeUnit timeUnit) throws InterruptedException {
        return blockingQueue.poll(l, timeUnit);
    }

    @Override
    public int remainingCapacity() {
        return blockingQueue.remainingCapacity();
    }

    @Override
    public boolean remove(Object o) {
        return blockingQueue.remove(o);
    }

    @Override
    public E remove() {
        return blockingQueue.remove();
    }

    @Override
    public boolean contains(Object o) {
        return blockingQueue.contains(o);
    }

    @Override
    public int drainTo(@NotNull Collection<? super E> collection) {
        return blockingQueue.drainTo(collection);
    }

    @Override
    public int drainTo(@NotNull Collection<? super E> collection, int i) {
        return blockingQueue.drainTo(collection, i);
    }
}
